package cn.iocoder.yudao.module.squaredancing.dal.mysql.download;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.squaredancing.controller.app.download.vo.DownloadPageReqVO;
import cn.iocoder.yudao.module.squaredancing.dal.dataobject.download.DownloadDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 视频下载 Mapper
 *
 * @author 赵云安
 */
@Mapper
public interface DownloadMapper extends BaseMapperX<DownloadDO> {

    default PageResult<DownloadDO> selectPage(DownloadPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DownloadDO>()
                .likeIfPresent(DownloadDO::getVideoName, reqVO.getVideoName())
                .eqIfPresent(DownloadDO::getUserId, reqVO.getUserId())
                .betweenIfPresent(DownloadDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DownloadDO::getId));
    }

}